<?php
require_once ("../src/db/connectdatabase.php");

function getIntroLoan($idloan) {
	$con = new ConnectDB();
	$tbl = "loans";
	$fn = array('info_emi_loan', 'intro_emi_footer_loan');
	$condetion = array('loan_id' => $idloan);
	return $con -> getvalue($tbl, $fn, $condetion);
}

if(isset($_GET['as'])) {
	$idloan = $_GET['as'];
	if($idloan == "vay_the_chap" || $idloan == "vay_tra_gop" || $idloan == "vay_ca_nhan") {
		$stringloan = "";
		if($idloan == "vay_the_chap") {
			$stringloan = "Vay Thế Chấp";
		} else if($idloan == "vay_tra_gop") {
			$stringloan = "Vay Trả Góp";
		} else if($idloan == "vay_ca_nhan") {
			$stringloan = "Vay Cá Nhân";
		}
		
		$introloan = getIntroLoan($idloan);
?>
<h3>Thông Tin Máy Tính Cho <?php echo($stringloan) ?></h3>
<div>
	<div style="clear:both; margin-top: 10px; border: 1px solid; padding: 5px; background: #61C799; border-radius: 5px; color:#FFF">Giới thiệu đầu trang</div>
    <div style="clear:both;"><?php if(count($introloan) > 0) {echo($introloan[0][0]);} ?></div>
    <div style="clear:both; margin-top: 10px; border: 1px solid; padding: 5px; background: #61C799; border-radius: 5px; color:#FFF">Giới thiệu cuối trang</div>
	<div style="clear:both;"><?php if(count($introloan) > 0) {echo($introloan[0][1]);} ?></div>
    <div><a href="admin.php?content=quanlivay&&as=<?php echo($idloan) ?>&&adrt=editinfoemipagerate"><input type="button" value="Chỉnh Sửa" style="border-radius: 5px; cursor:pointer; padding:5px; width:100px; background:#03F; color:#FFF; font-weight:bold;" /></a></div>
</div>
<?php
	}
}
?>